package com.sakura.probe.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Api(tags = "RedirectController",description = "跳转到相关的前端页面")
@Controller
public class RedirectController {
    @ApiOperation("/WEB-INF/html目录下的页面")
    @GetMapping("/{url}")
    public String redirect(@PathVariable("url") String url){
        return url;
    }

    @ApiOperation("/WEB-INF/html/topic目录下的页面")
    @GetMapping("/topic/{url}")
    public String redirectTopic(@PathVariable("url") String url){
        return "topic/"+url;
    }

    @ApiOperation("/WEB-INF/html/person目录下的页面")
    @GetMapping("/person/{url}")
    public String redirectPerson(@PathVariable("url") String url){
        return "person/"+url;
    }

    @ApiOperation("/WEB-INF/html/admin目录下的页面")
    @GetMapping("/admin/{url}")
    public String redirectAdmin(@PathVariable("url") String url){
        return "admin/"+url;
    }

    @ApiOperation("/WEB-INF/html/admin/person目录下的页面")
    @GetMapping("/admin/person/{url}")
    public String redirectAdminPerson(@PathVariable("url") String url){
        return "admin/person/"+url;
    }

    @ApiOperation("/WEB-INF/html/admin/topic目录下的页面")
    @GetMapping("/admin/topic/{url}")
    public String redirectAdminTopic(@PathVariable("url") String url){
        return "admin/topic/"+url;
    }

    @ApiOperation("/WEB-INF/html/admin/feedback目录下的页面")
    @GetMapping("/admin/feedback/{url}")
    public String redirectAdminFeedBack(@PathVariable("url")String url){
        return "admin/feedback/"+url;
    }


}
